﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CUREDataAccessLayers;
using CUREEntity;
using System.Data;

namespace CUREBusinessLogicLayer
{
    public class LoginBLL
    {
        LoginDAL lgdal = new LoginDAL();
        public string GetPassword(string str)
        {
            return lgdal.GetPassword(str);
        }
        public Decimal GetID(string s1, string s2)
        {
            return lgdal.GetID(s1, s2);
        }
        public Decimal GetID(string s1)
        {
            return lgdal.GetID(s1);
        }
        public Decimal GetGROUP_ID(string name, string password)
        {
            return lgdal.GetGROUP_ID(name, password);
        }
        public Decimal GetGROUP_ID(string name)
        {
            return lgdal.GetGROUP_ID(name);
        }

        /// <summary>
        /// 根据角色判断此用户是否有权限
        /// </summary>
        /// <param name="where">groupid:角色，url：路径</param>
        /// <returns></returns>
        public bool JudgeAuthorityByGroupID(IDictionary<string, object> where)
        {
            bool judge = false;
            try
            {
                judge = lgdal.JudgeAuthorityByGroupID(where);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.ToString());
            }
            return judge;
        }
        /// <summary>
        /// 生成登录日志
        /// </summary>
        public bool WriteOnline(string UserId, string UserName, string HostName)
        {
            return lgdal.WriteOnline(UserId, UserName, HostName);
        }
        /// <summary>
        /// 退出登录
        /// </summary>
        public bool DeleteOnline(string UserId, string HostName)
        {
            return lgdal.DeleteOnline(UserId, HostName);
        }
        /// <summary>
        /// 查询登录
        /// </summary>
        public bool IsOnline(string UserId, string HostName)
        {
            return lgdal.IsOnline(UserId, HostName);
        }

    }
}
